package com.k.ums.datasource;

import com.k.ums.enums.DataSourceType;

/**
 * @Description:
 * @Author: kt
 * @CreateTime: 2022/1/8
 */
public class DynamicDataSourceContextHolder {
    private static final ThreadLocal<String> DATA_SOURCE_TYPE = new ThreadLocal();

    public static void set(DataSourceType dataSourceType) {
        DATA_SOURCE_TYPE.set(dataSourceType.name());
    }

    public static String get() {
        return DATA_SOURCE_TYPE.get();
    }

    public static void clear() {
        DATA_SOURCE_TYPE.remove();
    }
}
